<template>
	<view class="myself">
		<view class="myself_tx_box">
			<view class="myself_tx">
				<u-avatar size="160" :src="avatarimg"></u-avatar>
			</view>
			<view class="myself_tx_title">
				<view>
					<text class="myself_tx_title_name">{{username}}</text>
					<text class="myself_tx_title_ranks">{{zhiwei}}</text>
				</view>
				<view>
					<text class="myself_tx_title_local">{{local}}</text>
				</view>
			</view>
			<view class="myself_tx_setting" @click="toSetting">
				<view class="myself_tx_setting_button">
					<image style="width: 50rpx;height: 50rpx;margin: 0 auto;display: block;" src="https://vkceyugu.cdn.bspapp.com/VKCEYUGU-baf89db3-4d55-4b1f-a05e-c0a1170f8dce/a267ed63-3a5c-41b9-aaf2-a6077025ee20.png"></image>
				</view>
			</view>
		</view>
		<yt-card size="35" backColor="#AF1F24FF" v-show="!ishouse_manage && !isexamine">
			<u-row gutter="0" style="margin: 0 auto;color: #fff;">
				<u-col :span="4" text-align="center">
					<view style="flex">
						<view style="display: inline-block;margin: 45rpx 0;font-size: 35rpx;">
							<view style="margin: 20rpx 0;">
								<text>￥</text><text>0.00</text>
							</view>
							<view style="font-size: 28rpx;font-weight: 100;">
								今日预估
							</view>
						</view>
						<u-line style="display: inline-block;float: right;margin: 45rpx 0;" length="140" color="#FFFFFF88" direction="col"></u-line>
					</view>
				</u-col>
				<u-col :span="4" text-align="center">
					<view style="flex">
						<view style="display: inline-block;margin: 45rpx 0;font-size: 35rpx;">
							<view style="margin: 20rpx 0;">
								<text>￥</text><text>0.00</text>
							</view>
							<view style="font-size: 28rpx;font-weight: 100;">
								本月预估
							</view>
						</view>
						<u-line style="display: inline-block;float: right;margin: 45rpx 0;" length="140" color="#FFFFFF88" direction="col"></u-line>
					</view>
				</u-col>
				<u-col :span="4" text-align="center">
					<view style="display: inline-block;margin: 45rpx 0;font-size: 35rpx;">
						<view style="margin: 20rpx 0;">
							<text>￥</text><text>0.00</text>
						</view>
						<view style="font-size: 28rpx;font-weight: 100;">
							年度预估
						</view>
					</view>
				</u-col>
			</u-row>
		</yt-card>
		<yt-card head="我的详情" size="35" v-show="!isexamine">
			<view style="margin-bottom: 60rpx;">
				<u-row>
					<u-col :span="3" text-align="center" v-show="!ishouse_manage || isboss">
						<yt-opcation-item
						icon="https://vkceyugu.cdn.bspapp.com/VKCEYUGU-baf89db3-4d55-4b1f-a05e-c0a1170f8dce/e52b3f07-1da0-4a0c-8f34-ead8bc113534.png" 
						text="全部订单"
						class="opcation_list_item"
						@click="intoComponent"
						>
						</yt-opcation-item>
					</u-col>
					<u-col :span="3" text-align="center" v-show="ishouse_manage || isboss">
						<yt-opcation-item
						icon="https://vkceyugu.cdn.bspapp.com/VKCEYUGU-baf89db3-4d55-4b1f-a05e-c0a1170f8dce/cae84936-45cb-4b32-9035-5bc24151c74a.png" 
						text="入库记录"
						class="opcation_list_item"
						@click="intoComponent"
						>
						</yt-opcation-item>
					</u-col>
					<u-col :span="3" text-align="center" v-show="ishouse_manage || isboss">
						<yt-opcation-item
						icon="https://vkceyugu.cdn.bspapp.com/VKCEYUGU-baf89db3-4d55-4b1f-a05e-c0a1170f8dce/c24e1f89-feea-43f4-b1a2-691cf2e63c99.png" 
						text="出库记录"
						class="opcation_list_item"
						@click="intoComponent"
						>
						</yt-opcation-item>
					</u-col>
				</u-row>
			</view>
		</yt-card>
		<yt-tabbar></yt-tabbar>
		<u-toast ref="uToast" />
	</view>
</template>

<script>
	import ytTabbar from '../../comment/yt-tabbar.vue'
	import ytCard from '../../comment/yt-card.vue'
	import ytOpcationItem from '../../comment/yt-opcation-item.vue'
	export default {
		data() {
			return {
				username:'',
				zhiwei:'',
				local:'',
				avatarimg:'',
				isexamine:true,
				isboss:false,
				ishouse_manage:false
			};
		},
		onLoad() {
			this.username = uni.getStorageSync('lastUsername')
			this.zhiwei = uni.getStorageSync('role').role_name
			this.local = uni.getStorageSync('role').comment
			if(uni.getStorageSync('role').permission == "examine"){
				this.isexamine = true
			}else{
				this.isexamine = false
				if(uni.getStorageSync('role').permission == "admin"){
					this.isboss = true
				}else{
					this.isboss = false
				}
			}
			if(uni.getStorageSync('role').permission == "house_manage"){
				this.ishouse_manage = true
			}else{
				this.ishouse_manage = false
				if(uni.getStorageSync('role').permission == "admin"){
					this.isboss = true
				}else{
					this.isboss = false
				}
			}
		},
		onShow() {
			uniCloud.callFunction({
				name: 'uni-id-cf_mobile',
				data: {
					action:"get_avatar"
				}
			}).then(res=>{
				this.avatarimg = res.result.userInfo.avatar
			}).catch(err=>{
				console.log(err)
			})
		},
		methods:{
			toSetting(){
				uni.navigateTo({
					url:'../setting/setting'
				})
			},
			intoComponent(componentName){
				switch (componentName){
					case '全部订单':
						uni.navigateTo({
							url:''
						})
						break;
					case '入库记录':
						uni.navigateTo({
							url:'../lookHouse/lookHouse'
						})
						break;	
					case '出库记录':
						uni.navigateTo({
							url:'../recordOutHouse/recordOutHouse'
						})
						break;		
					default:
						break;
				}
			}
		},
		components:{
			ytTabbar,
			ytCard,
			ytOpcationItem
		}
	}
</script>

<style lang="scss" scoped>
.myself{
	position: absolute;
	top: 0;
	background-color: #EEEEEEFF;
	height: 1380rpx;
	width: 100%;
}
.fun_item{
	font-size: 30rpx;
	margin: 0rpx auto;
}
.myself_tx_box{
	background-color: #EEEEEEFF;
	width: 100%;
	border-radius: 0 0 26.7rpx 26.7rpx;
	.myself_tx{
		display: inline-block;
		margin-top: 50.73rpx;
		margin-left: 61.41rpx;
	}
	.myself_tx_title{
		color: #000;
		display: inline-block;
		vertical-align: percentage($number: 0.5);
		margin-left: 40.05rpx;
		.myself_tx_title_name{
			font-weight: bold;
			font-size: 53.4rpx;
		}
		.myself_tx_title_ranks{
			margin-left: 43.71rpx;
			font-size: 29.37rpx;
		}
		.myself_tx_title_local{
			display: inline-block;
			border: 1rpx solid #707070FF;
			padding: 5rpx 20rpx;
			border-radius: 100rpx;
			margin-top: 30rpx;
			font-size: 28rpx;
		}
	}
	.myself_tx_setting{
		color: #000;
		display: inline-block;
		float: right;
		margin: 30rpx 40rpx;
	}
}
</style>
